package com.example.userserver.entities;

import com.example.server_engineer.entities.AbstractDomainEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;


import java.util.ArrayList;

import java.util.Date;


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "user")
public class User extends AbstractDomainEntity {
    @Id
    @Schema(description = "用户编号")
    @Column(length = 20)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Schema(description = "密码")
    @Column(length = 20)
    private String password;

    @Column(length = 20)
    @Schema(description = "用户名")
    private String username;

    @Schema(description = "用户性别（1:男，0：女）")
    private Integer sex;

    @Schema(description = "用户头像")
    private String img;

    @Schema(description = "删除标记（1：正常；0：删除）")
    private Integer delTag;
//
//    @Schema(description = "真实姓名")
//    private String realName;


//    @Schema(description = "组织id")
//    private Long organizationId;
//
//    @Schema(description = "组织名")
//    private String organizationName;
//
//    @Schema(description = "科室Id")
//    private Long departId;
//
//    @Schema(description = "科室名")
//    private String departName;


//    @Schema(description = "用户姓名")
//    private String name;
//
//    @Schema(description = "首字母")
//    private String abbrName;
//
//    @Schema(description = "用户类型")
//    private String type;

    @Schema(description = "手机号")
    private String mobilePhone;

//    @Schema(description = "额外描述信息")
//    private String tags;


//    @Schema(description = "OA用户唯一标识")
//    private String oaId;

    @Schema(description = "联系方式")
    // @Pattern(regexp = "^1(3|4|5|7|8)\\d{9}$", message = "手机号码格式错误！")
    private String tel;

    @Schema(description = "邮箱")
    private String email;

    @Schema(description = "账户是否可用")
    private boolean enabled = true;


    @Schema(description = "凭据是否未过期")
    private boolean credentialsNonExpired = true;

    @Schema(description = "账号是否未锁定")
    private boolean accountNonLocked = true;

    @Schema(description = "账户是否未过期")
    private boolean accountNonExpired = true;

    @Schema(description = "密码过期时间，密码有效时间")
    private Date credentialsExpiredDate;

    @Schema(description = "账号过期时间（账号有效时间）")
    private Date accountExpiredDate;

    //
    @JsonIgnore
    @Transient
    private String secret;
    //
    //@JsonIgnore
    @Transient
    private String accessToken;

//    @OneToMany(mappedBy = "userId")
//    private List<Cart> cartList;

//    @OneToMany(mappedBy = "userId")
//    private List<DeliveryAddress> addressList;


}